package vn.edu.hut.soict.translate.dictionary.bilingual;

public class SimpleDictionaryEntry {
	private String meaning;
	private PartOfSpeech partOfSpeech;

	public SimpleDictionaryEntry(String meaning, PartOfSpeech partOfSpeech) {
		this.meaning = meaning;
		this.partOfSpeech = partOfSpeech;
	}

	public String getMeaning() {
		return meaning;
	}

	public PartOfSpeech getPartOfSpeech() {
		return partOfSpeech;
	}

	@Override
	public String toString() {
		return meaning + " (" + partOfSpeech + ")";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((partOfSpeech == null) ? 0 : partOfSpeech.hashCode());
		result = prime * result + ((meaning == null) ? 0 : meaning.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		SimpleDictionaryEntry other = (SimpleDictionaryEntry) obj;
		if (partOfSpeech == null) {
			if (other.partOfSpeech != null) return false;
		}
		else if (!partOfSpeech.equals(other.partOfSpeech)) {
			return false;
		}
		if (meaning == null) {
			if (other.meaning != null) {
				return false;
			}
		}
		else if (!meaning.equals(other.meaning)) {
			return false;
		}
		return true;
	}
}